#include"cpp_pubsub/cpp_publisher.hpp"

MyPublisher::MyPublisher():Node("mypublisher"),count(0){
    publisher = this->create_publisher<std_msgs::msg::String>("topic",10);
    timer = this->create_wall_timer(1000ms,std::bind(&MyPublisher::timer_callback,this));
}

void MyPublisher::timer_callback(){
    auto message = std_msgs::msg::String();
    message.data = "Hello world! " + std::to_string(count++);
    RCLCPP_INFO(this->get_logger(),"Publishing: '%s'",message.data.c_str());
    publisher->publish(message);
}